package creation_patterns.builder_pattern;

import creation_patterns.builder_pattern.abstract_builder.Builder;
import creation_patterns.builder_pattern.concrete_builder.HpBuilder;
import creation_patterns.builder_pattern.concrete_builder.IntelBuilder;
import creation_patterns.builder_pattern.director.Director;
import creation_patterns.builder_pattern.product.computer.Computer;
/*
 * @Author xuhj
 * @Description 构建者模式不仅仅用于大的domain对象，更常常用于大的引用其他对象的大类，并且这些引用有很多不同的实现
 * e.g. xxximpl{
 * private RedisTemplate redistemplate;
 * private InitService init;
 * }
 * @Date 8:36 下午 2022/1/1
 * @Param
 * @return
 **/
public class Test {
    public static void main(String[] args) {
        // Intel
        Builder builder = new IntelBuilder().buildCPU().buildDisplay().buildMainBoard();
        Director director = new Director(builder);
        Computer construct = director.construct();
        construct.getCpu().createCPU();


        // Hp
        Builder hpBuilder = new HpBuilder().buildCPU().buildDisplay().buildMainBoard();
        Director hpDirector = new Director(hpBuilder);
        Computer hpComputer= hpDirector.construct();
        hpComputer.getCpu().createCPU();

    }
}
